<form class="layui-form " action="" lay-filter="dataForm">
    <input type="hidden" name="id">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" lay-verify="required" autocomplete="off" placeholder="请输入用户名" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">昵称</label>
        <div class="layui-input-block">
            <input type="text" name="nickname" autocomplete="off" placeholder="请输入昵称" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">手机号</label>
        <div class="layui-input-block">
            <input type="text" name="phone" lay-verify="required|phone" autocomplete="off" placeholder="请输入手机号" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">提成比例</label>
        <div class="layui-input-inline">
            <input type="text" name="push_money" lay-verify="required" placeholder="请输入小数" autocomplete="off" class="layui-input">
        </div>
        <div class="layui-form-mid layui-word-aux">%</div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">备注</label>
        <div class="layui-input-block">
            <input type="text" name="remark" autocomplete="off" placeholder="请输入备注" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">专属二维码</label>
        <div class="layui-input-block">
           <img src="{$qrcode}" alt="" style="max-width:325px;max-height:325px">
        </div>
    </div>
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit="" lay-filter="dataSubmit">保存</button>
            <button class="layui-btn layui-btn-warm" type="button" id="resetPwd" data-id="{$id}">重置密码</button>
        </div>
    </div>
</form>
<script>
    layui.use(['form', 'http'], function() {
        var form = layui.form;
        var http = layui.http;
        var $ = layui.$;
        $("#resetPwd").click(function name(res) {            
            http.post('/setting/customerserviceresetpwd', {'id':$(this).data('id')}, function(res) {
                if (res.code == 0) {
                    parent.layui.table.reload('dataTable');
                    parent.layer.closeAll('page');
                }
            }, $(this))
        })

        //表单初始赋值
        form.val('dataForm', {
                "id": "{$id}",
                "username": "{$username}",
                "nickname": "{$nickname}",
                "phone": "{$phone}",
                "push_money": "{$push_money}",
                "remark": "{$remark}",
            })

        //监听提交
        form.on('submit(dataSubmit)', function(data) {
            http.post('/setting/customerserviceedit', data.field, function(res) {
                if (res.code == 0) {
                    parent.layui.table.reload('dataTable');
                    parent.layer.closeAll('page');
                }
            }, $(this))
            return false;
        });

    });
</script>